package com.wz.utils.time;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class TimeUtils {
    public static void main(String[] args) throws ParseException {
        String strdate = new SimpleDateFormat("yyyyMMddhhmmss-SSS").format(new Date());
        System.out.println(strdate);

        System.out.println(LocalDateTime.now(ZoneId.of("Asia/Shanghai")).toString()
                .replaceAll("\\:", "-")
                .replaceAll("\\.", "-")
                .replace("T", " ")
        );
        System.out.println(LocalDateTime.now(ZoneId.of("Asia/Shanghai")).format(DateTimeFormatter.ofPattern("yyyyMMddhhmmss-SSS")));
    }
}
